﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.ComponentModel;
using System.Drawing.Design;

namespace UIPrototyper
{
    class ComboBoxProperties : Property,IChanged 
    {
        private CustomComboBox comboBox;

        public ComboBoxProperties(CustomComboBox pComboBox)
        {
            this.comboBox = pComboBox;
        }

        [DescriptionAttribute("O nome da ComboBox"),
        CategoryAttribute("ComboBox")]
        public override string Nome
        {
            get { return this.comboBox.Name; }
            set { this.comboBox.Name = value; LaunchChangedEvent(this.comboBox); }
        }

        [DescriptionAttribute("Os itens que serão apresentados no ComboBox."),
        CategoryAttribute("ComboBox"), EditorAttribute("UIPrototyper.ListItemEditor, System.Design", typeof(UITypeEditor))]
        public ItemCollection Itens
        {
            get { return this.comboBox.Items; }
        }

        #region IChanged Members

        public event ChangedHandler iChanged;

        public void LaunchChangedEvent(IChanged pChangedObject)
        {
            if (iChanged != null)
            {
                iChanged(pChangedObject);
            }
        }

        #endregion
    }
}
